Skip to content

Add inline SVG data_url preview fallback#4

Merged
edumgt merged 1 commit intomainfrom
codex/fix-image-not-displaying
Feb 12, 2026
Merged

Add inline SVG data_url preview fallback#4
edumgt merged 1 commit intomainfrom
codex/fix-image-not-displaying

Conversation

@edumgt
Copy link
Copy Markdown
Owner

@edumgt edumgt commented Feb 12, 2026

Motivation

  • Users reported that generated images sometimes do not appear in the browser, so the preview should render even when the static outputs URL is inaccessible or cached incorrectly.

Description

  • Backend now Base64-encodes the generated SVG preview and returns a data_url in the generation response by extending GeneratorService.generate and changing _create_preview_svg to return (Path, str) in backend/app/generator.py.
  • Frontend now prefers the returned data_url when setting resultImage.src and falls back to the cache-busted file_url if data_url is not present in frontend/app.js.
  • The API contract was extended by adding data_url to the GenerationResult model and the unit test tests/test_api.py was updated to assert the presence of the data_url field.
  • Modified files: backend/app/generator.py, frontend/app.js, and tests/test_api.py.

Testing

  • Ran unit tests with pytest -q, which completed successfully and reported 3 passed.
  • Updated API test asserts the new data_url field and its data:image/svg+xml;base64, prefix.

Codex Task

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@edumgt edumgt merged commit d7d7175 into main Feb 12, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant